package com.sky.mapper;

import com.sky.entity.Address;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface AddressMapper {
    @Insert("INSERT INTO address(name, phone, address, status) VALUES(#{name}, #{phone}, #{address}, #{status})")
    int insert(Address address);

    @Select("SELECT * FROM address WHERE status = 1")
    List<Address> selectAllVisible();

    @Update("UPDATE address SET name=#{name}, phone=#{phone}, address=#{address}, status=#{status} WHERE id=#{id}")
    int update(Address address);

    @Delete("DELETE FROM address WHERE id=#{id}")
    int delete(Long id);
}
